<?php
/*
 * This is next page for upgrading to baby.
 */
include '../config.php';
session_start();
?>
<?php include '../head.php'; ?>
<title>Upgrade to SalusBaby</title>
<body>
    <div id="wrapper">
        <?php include '../header_profile_baby.php'; ?>        

        <div id="mainContent">
            <div id="mainContent" style="border: 1px #000000 dotted ; width: 600px; margin-left: 30%; "><br/>
                <center><h1>JOIN WITH <br/><img src="http://<?= $_SERVER['HTTP_HOST'] ?>/salusbaby/include/images/me.png" height="100px;" /> </h1></center><hr>
                <?php if ($_GET['v'] == 'direct') { ?>
                    <h3 style="color : green;" >DETAILS :</h3><?php
                $detal = mysql_fetch_array(mysql_query("select detail from salus_buy_detail where FK_fa_product_id = 1 "));
                echo $detal[0];
                    ?><br/><hr>
                    <form action="pay.php" method="post" >
                        <b style="color : #634532;">Choose your subscription :</b>
                        <select name="pro_de_id" >
                            <?php
                            $q1 = mysql_query("select * from salus_buy_detail where FK_fa_product_id = 1") or die(mysql_error());
                            while ($row2 = mysql_fetch_array($q1)) {
                                ?>
                                <option value="<?= $row2['id'] ?>" style="height: 20px;"  ><?= $row2[2] ?> @ <?= $row2[3] ?> &euro; </option>                                                                                
                            <?php } ?>
                        </select><br/><br/>                                   
                        <input type="hidden" name="pro_id" value="1" />
                        <input type="hidden" name="type" value="direct" />                        
                        <center><input type="submit" value="Proceed To Next Step"/></center>
                    </form>
                    <?php
                } else {
                    $pdid = $_GET['pdid'];
                    $det = mysql_query("select * from salus_buy_detail where id= '$pdid'") or die(mysql_error());
                    while ($row = mysql_fetch_array($det)) {
                        $yr = $row['product_year'];
                        $pri = $row['product_prize'];
                    }

                    $code = $_SESSION['pre_code'];
                    $dis = $_SESSION['discount'];
                    ?>
                    <?php
                    $disc = $dis / 100;
                    $buy = mysql_query("select * from salus_buy_detail where id = '$pdid' ") or die(mysql_error());
                    while ($row1 = mysql_fetch_array($buy)) {
                        $maincost = $row1[3];
                        $dis1 = $maincost * $disc;
                        $pad = $maincost - $dis1;
                        $pad = $pad / 2;
                    }
                    ?>
                    <h3 style="color : blue;"> DETAILS : </h3>
                    Subscription Year : <b><?= $yr ?></b><br/>
                    Original Prize : <b><?= $pri ?> &euro;</b><br/>         
                    Discount : <b><?= $dis ?> &percnt; </b><br/>
                    You'll pay : <b><?= $pad ?> &euro; </b><br/>

                    <form action="pay.php" method="post">
                        <input type="hidden" name="type" value="seller" />
                        <center><input type="submit" value="Proceed To Next Step" /></center>
                    </form>

                <?php }
                ?>
            </div>

        </div>
    </div>
</body>